Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
www
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PLN
www
Commits
842f9b02
Commit
842f9b02
authored
Apr 25, 2021
by
PLN (Algolia)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MVP: Hydra integration
parent
35824fea
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
0 deletions
+54
-0
hydra.js
next/components/hydra.js
+49
-0
package.json
next/package.json
+1
-0
hydra.js
next/pages/hydra.js
+4
-0
yarn.lock
next/yarn.lock
+0
-0
No files found.
next/components/hydra.js
0 → 100644
View file @
842f9b02
import
React
,
{
useRef
,
useEffect
}
from
"react"
;
class
HydraSynth
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
width
=
props
.
width
;
this
.
height
=
props
.
height
;
}
componentDidMount
()
{
const
Hydra
=
require
(
'hydra-synth'
);
const
hydra
=
new
Hydra
({
// canvas element to render to. If none is supplied, a canvas will be created and appended to the screen
// canvas: this.canvasRef,
autoLoop
:
true
,
makeGlobal
:
true
,
numSources
:
4
,
detectAudio
:
false
,
numOutputs
:
4
,
});
hydra
.
setResolution
(
this
.
width
,
this
.
height
);
// This works! Now generate one for each :D
// TODO: One per page, with template and lib
// FIXME: Canvas position
// s0.initImage("https://git.plnech.fr/pln/Hydra/raw/master/StarryNights/img/halley.png");
// src(s0).out(o0)
// src(o0)
// .modulate(src(o0),() => Math.sin(time/100) / 10)
// .out(o1)
// src(o1)
// .modulateScale(osc(1,0.4),0.05)
// .blend(noise(100,0.92).colorama(),0.07)
// .out(o2)
// src(o2)
// .blend(src(o2).thresh(), () => 0.5 + 0.125 * Math.sin(time / 100 % 180))
// .scrollX(-0.05)
// // .scrollY(-0.1)
// .scale(1.08)
// .out(o3)
// render(o3)
}
render
()
{
return
<
canvas
ref
=
"{this.canvasRef}"
width
=
{
this
.
width
}
height
=
{
this
.
height
}
/>
;
}
}
export
default
HydraSynth
next/package.json
View file @
842f9b02
...
...
@@ -12,6 +12,7 @@
"classnames"
:
"^2.3.1"
,
"date-fns"
:
"^2.21.1"
,
"gray-matter"
:
"^4.0.2"
,
"hydra-synth"
:
"^1.3.8"
,
"next"
:
"^10.1.3"
,
"react"
:
"^17.0.2"
,
"react-dom"
:
"^17.0.2"
,
...
...
next/pages/hydra.js
View file @
842f9b02
...
...
@@ -2,6 +2,7 @@ import Image from "next/image";
import
Link
from
"next/link"
;
import
Head
from
"next/head"
;
import
Layout
from
"../components/layout"
;
import
HydraSynth
from
"../components/hydra"
;
export
async
function
getStaticProps
(
context
)
{
return
{
...
...
@@ -26,6 +27,9 @@ export default function Hydra() {
height={475}
/>
<p><i>Intermediary steps of <a href="https://nech.pl/nights-galactic">GaLactic</a></i></p>
<HydraSynth
width={700}
height={475} />
</div>
</Layout>
);
...
...
next/yarn.lock
View file @
842f9b02
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment