Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1.  
  2.  
  3. function setup() {
  4. createCanvas(500, 500, WEBGL);
  5.  
  6.  
  7. }
  8.  
  9. function draw() {
  10. createCanvas(500, 500, WEBGL);
  11.  
  12. /*Luis transitions*/
  13. EasingFunctions = {
  14. // no easing, no acceleration
  15. linear: function (t) { return t },
  16. // accelerating from zero velocity
  17. easeInQuad: function (t) { return t*t },
  18. // decelerating to zero velocity
  19. easeOutQuad: function (t) { return t*(2-t) },
  20. // acceleration until halfway, then deceleration
  21. easeInOutQuad: function (t) { return t<.5 ? 2*t*t : -1+(4-2*t)*t },
  22. // accelerating from zero velocity
  23. easeInCubic: function (t) { return t*t*t },
  24. // decelerating to zero velocity
  25. easeOutCubic: function (t) { return (--t)*t*t+1 },
  26. // acceleration until halfway, then deceleration
  27. easeInOutCubic: function (t) { return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1 },
  28. // accelerating from zero velocity
  29. easeInQuart: function (t) { return t*t*t*t },
  30. // decelerating to zero velocity
  31. easeOutQuart: function (t) { return 1-(--t)*t*t*t },
  32. // acceleration until halfway, then deceleration
  33. easeInOutQuart: function (t) { return t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t },
  34. // accelerating from zero velocity
  35. easeInQuint: function (t) { return t*t*t*t*t },
  36. // decelerating to zero velocity
  37. easeOutQuint: function (t) { return 1+(--t)*t*t*t*t },
  38. // acceleration until halfway, then deceleration
  39. easeInOutQuint: function (t) { return t<.5 ? 16*t*t*t*t*t : 1+16*(--t)*t*t*t*t }
  40. }
  41.  
  42. //background(220);
  43. //fill(255,255,255);
  44. noFill();
  45. stroke(0);
  46. strokeWeight(5);
  47. //rect(width/2,height/2,50,50);
  48.  
  49. //translate(width/2, 0, 0);
  50. push();
  51.  
  52.  
  53. //rotateX(PI/4);
  54. //rotateY(PI/4);
  55.  
  56. //translate(20,20,40);
  57. //rotateY(/*EasingFunctions.easeInOutQuint*/(frameCount * 0.3));
  58.  
  59.  
  60.  
  61. //camera(300, 300, 300, 0, 0, 0, 1, 0, 1);
  62.  
  63. rotateX(-PI/4);
  64. //rotateY(frameCount * 0.3);
  65. rotateY(EasingFunctions.easeInOutQuad(10+sin(frameCount*0.01)));
  66. box(40, 40, 40);
  67. console.log(frameCount);
  68.  
  69. pop();
  70.  
  71. /* //load 3d model ".obj"
  72. let teapot;
  73.  
  74. function setup() {
  75. createCanvas(400, 400, WEBGL);
  76. perspective();
  77. teapot = loadModel('teapot.obj');
  78. }
  79.  
  80. function draw() {
  81.  
  82. model(teapot);
  83.  
  84. }
  85. */
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement