blob+svg_startclone
This commit is contained in:
+48
-20
@@ -1,37 +1,65 @@
|
|||||||
|
// The amount of segment points we want to create:
|
||||||
|
var amount = 3;
|
||||||
|
|
||||||
|
// The maximum height of the wave:
|
||||||
|
var height = 300;
|
||||||
|
|
||||||
|
// Create a new path and style it:
|
||||||
var path = new Path({
|
var path = new Path({
|
||||||
fillColor: 'black'
|
// 80% black:
|
||||||
|
strokeColor: [0.8],
|
||||||
|
strokeWidth: 30,
|
||||||
|
strokeCap: 'square'
|
||||||
});
|
});
|
||||||
var url = 'trame.svg';
|
|
||||||
var raster = new Raster(url);
|
|
||||||
|
|
||||||
var amount = 3
|
var raster = new Raster({
|
||||||
|
source: 'trame.svg',
|
||||||
|
position: view.center
|
||||||
|
});
|
||||||
|
|
||||||
for (var i = 0; i < amount; i++) {
|
path.clipMask = true;
|
||||||
raster.position = new Point(300,600) * Point.random(view.size);
|
// path.selected = true;
|
||||||
// var point = new Point(600, 650) * Point.random(view.size);
|
path.closed = true;
|
||||||
path.add(raster.position);
|
// path.fullySelected = true;
|
||||||
var segment = path.segments[i];
|
|
||||||
|
// Add 5 segment points to the path spread out
|
||||||
|
// over the width of the view:
|
||||||
|
for (var i = 0; i <= amount; i++) {
|
||||||
|
var maxPoint = new Point(700, 700);
|
||||||
|
|
||||||
|
var point = maxPoint * Point.random(view.size) + 70;
|
||||||
|
path.add(point);
|
||||||
|
|
||||||
|
// path.add(new Point(500 / 700) * view.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
path.closed = true;
|
// Select the path, so we can see how it is constructed:
|
||||||
path.fullySelected = true;
|
|
||||||
path.clipMask = true;
|
|
||||||
|
|
||||||
function onFrame(event) {
|
function onFrame(event) {
|
||||||
// Loop through the segments of the path:
|
// Loop through the segments of the path:
|
||||||
|
for (var i = 0; i <= amount; i++) {
|
||||||
|
var segment = path.segments[i];
|
||||||
|
// A cylic value between -1 and 1
|
||||||
|
|
||||||
// A cylic value between -1 and 1
|
var sinus = Math.sin(event.time * 0.05+ i);
|
||||||
for (var i = 0; i <= amount; i++) {
|
|
||||||
var sinus = Math.sin(event.time * 1 + i);
|
|
||||||
|
|
||||||
// Change the y position of the segment point:
|
// Change the y position of the segment point:
|
||||||
segment.point.y = sinus * 100 + 100;
|
segment.point.y = sinus * height + 500;
|
||||||
segment.point.x = sinus * 50 + 150;
|
}
|
||||||
|
// Uncomment the following line and run the script again
|
||||||
path.smooth();
|
// to smooth the path:
|
||||||
}
|
path.smooth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var copy = path.clone();
|
||||||
|
copy.fullySelected = true;
|
||||||
|
copy.position.x += 500;
|
||||||
|
copy.smooth();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user