Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function setup() {
- createCanvas(500, 500, WEBGL);
- }
- function draw() {
- createCanvas(500, 500, WEBGL);
- /*Luis transitions*/
- EasingFunctions = {
- // no easing, no acceleration
- linear: function (t) { return t },
- // accelerating from zero velocity
- easeInQuad: function (t) { return t*t },
- // decelerating to zero velocity
- easeOutQuad: function (t) { return t*(2-t) },
- // acceleration until halfway, then deceleration
- easeInOutQuad: function (t) { return t<.5 ? 2*t*t : -1+(4-2*t)*t },
- // accelerating from zero velocity
- easeInCubic: function (t) { return t*t*t },
- // decelerating to zero velocity
- easeOutCubic: function (t) { return (--t)*t*t+1 },
- // acceleration until halfway, then deceleration
- easeInOutCubic: function (t) { return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1 },
- // accelerating from zero velocity
- easeInQuart: function (t) { return t*t*t*t },
- // decelerating to zero velocity
- easeOutQuart: function (t) { return 1-(--t)*t*t*t },
- // acceleration until halfway, then deceleration
- easeInOutQuart: function (t) { return t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t },
- // accelerating from zero velocity
- easeInQuint: function (t) { return t*t*t*t*t },
- // decelerating to zero velocity
- easeOutQuint: function (t) { return 1+(--t)*t*t*t*t },
- // acceleration until halfway, then deceleration
- easeInOutQuint: function (t) { return t<.5 ? 16*t*t*t*t*t : 1+16*(--t)*t*t*t*t }
- }
- //background(220);
- //fill(255,255,255);
- noFill();
- stroke(0);
- strokeWeight(5);
- //rect(width/2,height/2,50,50);
- //translate(width/2, 0, 0);
- push();
- //rotateX(PI/4);
- //rotateY(PI/4);
- //translate(20,20,40);
- //rotateY(/*EasingFunctions.easeInOutQuint*/(frameCount * 0.3));
- //camera(300, 300, 300, 0, 0, 0, 1, 0, 1);
- rotateX(-PI/4);
- //rotateY(frameCount * 0.3);
- rotateY(EasingFunctions.easeInOutQuad(10+sin(frameCount*0.01)));
- box(40, 40, 40);
- console.log(frameCount);
- pop();
- /* //load 3d model ".obj"
- let teapot;
- function setup() {
- createCanvas(400, 400, WEBGL);
- perspective();
- teapot = loadModel('teapot.obj');
- }
- function draw() {
- model(teapot);
- }
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement