Rolling a square: School Of Motion Response

Sdílet
Vložit
  • čas přidán 28. 08. 2014
  • School of motion just had a tutorial about rolling a square.
    www.schoolofmotion.com/project...
    Joey said that he had trouble getting the triganometry to work properly, so this is how to do it. be sure to go check out his tutorial, and also the rest of the 30 days of After Effects currently going on right now. pretty cool stuff.
    here is the expression
    rot=transform.rotation;
    scl=transform.scale[0]/100;
    w=(this.width/2)*scl;
    r=(degreesToRadians(rot))*2;
    t=transform.position;
    slider=effect("Slider Control")("Slider");
    [t[0]+w*rot/45,t[1]-(Math.abs(slider*Math.sin(r)))*scl];
    My Tip Jar: goo.gl/rYpW42
    ⭐️ UNLIMITED STOCK DOWNLOADS
    Access to over 600,000 ready-to-use After Effects Templates, Stock Footage, Fonts, Templates and more! cinemaspice.net/envato
    to help support this channel.
    Don't forget to share this video. You never know who among your friends is a closet After Effects user. Thanks.
    Twitter
    / longlivemikey
    Facebook:
    / thecinemaspice
    If you need stock footage, photos and even After Effects templates. Go check out Envato Elements. cinemaspice.net/envato
    to help support this channel.
    Don't forget to share this video. You never know who among your friends is a closet After Effects user. Thanks.
    Twitter
    / longlivemikey
    Facebook:
    / thecinemaspice

Komentáře • 73

  • @JesseJuup
    @JesseJuup Před 10 lety +1

    You just made my day, what an eye-opener! Huge thanks!

  • @drewjackson6174
    @drewjackson6174 Před 10 lety

    Love your tutorials bro. Keep them coming!

  • @gregtasi
    @gregtasi Před 6 lety

    This is pure gold!

  • @kevthecoder
    @kevthecoder Před 10 lety

    Pretty Cool! Thanks for this!

  • @yldmaker7760
    @yldmaker7760 Před 7 lety

    really helpful, thank you

  • @jpiko
    @jpiko Před 10 lety +1

    Great tut, I would like to see more expression tutorials. Great work. Love it!

  • @zaldyalcos8598
    @zaldyalcos8598 Před 7 lety

    your so great sir

  • @ninjanels
    @ninjanels Před 10 lety +1

    a new level of respect for you. I never knew you knew trig. You are the Mad Scientist... making your list...

    • @Specularrrr
      @Specularrrr Před 10 lety

      i thought everyone learns trigonometry at school :)

    • @LongLiveMikey
      @LongLiveMikey  Před 10 lety +1

      Specular Some of us haven't been to school in quite some time :)

  • @KuneMaster
    @KuneMaster Před 10 lety

    Cool tutorial... thx

  • @gaohuan2956
    @gaohuan2956 Před 4 lety +1

    太棒了,谢谢您的分享·~

  • @palpytine
    @palpytine Před 6 lety +3

    With a bit more cleanup...
    rotDeg = transform.rotation;
    rotRad = degreesToRadians(rotDeg);
    scaleFactor = transform.scale[0] / 100;
    scaledWidth = this.width * scaleFactor;
    slider = effect("Slider Control")("Slider");
    hOffset = scaledWidth * rotDeg / 720;
    vOffset = Math.abs(scaleFactor * slider * Math.sin(rotRad * 2));
    add(transform.position, [hOffset, -vOffset]);

  • @slouma1998
    @slouma1998 Před 10 lety

    I am really impressed by the tutorial i didn't know that you are good a expression i hope that you make a serie of tuts about advanced expression because all tuts are for beginners i am sure that you'll get many more views :D

  • @chickenlimbs88
    @chickenlimbs88 Před 7 lety

    thanks this is really helpful! Would this be easily adapted for a hexagon shape?

  • @claymaysh
    @claymaysh Před 9 lety

    that's pretty neat

  • @JoshuaOnTheTube
    @JoshuaOnTheTube Před 4 lety +7

    Hi I get this error:
    Error: couldn't turn rotation into numeric value.

    • @DiogoMendesPinto
      @DiogoMendesPinto Před 4 lety +2

      Just go to File > Project Settings > Expressions > Legacy ExtendScript

    • @EmmaBay
      @EmmaBay Před 3 lety +3

      If you replace "this.width" with "thisLayer.width" it will work without changing the Project Settings.

    • @RubenCurbelo
      @RubenCurbelo Před 2 lety

      @@EmmaBay 🙏 this saved my life. Thank you

  • @funside7662
    @funside7662 Před 2 lety +1

    Thats awsome, can you please tell me how can i apply this expression to my square quickly? i just tried to paste the expression in my square position but it did not work.

  • @nikkiritmeijer4562
    @nikkiritmeijer4562 Před 7 lety

    Any idea how to tweak this for not perfectly square shapes?

  • @dariangarrrett721
    @dariangarrrett721 Před 6 lety

    Can you do one with a non round shape? something like an egg?

  • @leonpeeon
    @leonpeeon Před 10 lety

    Man, that was magic. Sorcery, even.

  • @lisamartina7892
    @lisamartina7892 Před 6 měsíci

    My square isn’t moving I used the same code that was used at the end of the video and my vector square isn’t moving 😢

  • @MartialFlix
    @MartialFlix Před 10 lety

    Brother can you tell how you compress this file so small in size?thanks

  • @adamcross287
    @adamcross287 Před 4 lety

    How would you do this with a triangle? Anyone have any advice? Thanks

  • @davidcharle4869
    @davidcharle4869 Před 6 lety

    can we use same expression for hexagon ??

  • @sergedruz7261
    @sergedruz7261 Před 4 lety +2

    great tut, thank you.
    But in AE 2020
    Error: couldn't turn rotation into numeric value.

  • @Penggu_
    @Penggu_ Před 4 lety

    How do you turn that into a preset?

  • @Rillion02
    @Rillion02 Před 8 lety

    +MikeyBorup there is one thing i have to ask. whenever it is rolling is there a way to make it roll straight on the corners?

    • @Rillion02
      @Rillion02 Před 8 lety

      +MikeyBorup also it looks like the corners move is there a way to fix this?

  • @Specularrrr
    @Specularrrr Před 7 lety

    I think the value of the slider should be =(SQRT(2)/2-1/2)*H, with H the height of the layer :)

  • @dangehin7416
    @dangehin7416 Před 10 lety

    Any ideas on how you could apply this to a rectangle?

    • @LongLiveMikey
      @LongLiveMikey  Před 10 lety

      That would be much more difficult, but I think possible. you would need to calculated the scale difference between the long side vs the short side. and scale the trig equation. also you would need to know which side its on. that will be the hard part.

    • @dangehin7416
      @dangehin7416 Před 10 lety

      ***** Actually, and I should have explained earlier, all I was trying to do was pivot a rectangle from lying on its long side to standing on its short end. I was able to do it (and I am new to expressions, so I apologize if I don't explain this well) with the anchor point centered on the short end and the rotation at 0, I divided the sR property:
      sR=Math.abs(uS*Math.sin(r/2));
      I did also have to mess with the width line, but that was messed up from the start (it seemed to be taking the width of the entire composition) I had to manually enter the width and divide it by 4 instead of 2:
      w=(length(22.8)/4)*scl;
      Which seems to have accomplished what I wanted, though it wouldn't work past 90 degrees.

  • @spoojame03
    @spoojame03 Před 9 lety

    Can you not do the same thing just moving the anchor point?

    • @LongLiveMikey
      @LongLiveMikey  Před 9 lety

      not without a complex expression, (maybe trig is just as complex) you will need to move the anchor point to each corner as it rotates.

  • @JonBeech
    @JonBeech Před 3 lety

    How can position properties be added to this method to recreate the bounce effect as shown in the school of motion tutorial. I can't figure out how to rig that as the position curves are way off the box object and the x position is tied into the rotation property which seems counter intuitive to me.

    • @paulkingMotion
      @paulkingMotion Před 3 lety

      Hi Jonathan. I used the os cand version in the comments below to get my box to roll but I believe it should work with Mikey's tutorial version as well.
      - Create a null object
      - Parent your box layer to the null object. That means the null object can control your position and you can add the bounces with the y position in the null object layer. Hopefully that makes sense and it works for you.

  • @cynnidc
    @cynnidc Před 6 lety +4

    Could you make a tutorial on how to roll an egg?

  • @FraternalHouse
    @FraternalHouse Před 6 lety

    The Rolling Cube looks pretty good. But I still think Motion Graphics has ya beat w/ the real world bounce effect.

  • @josephburton4751
    @josephburton4751 Před 10 lety +2

    Mine gets a syntax error on line 8? Any Ideas??

    • @LongLiveMikey
      @LongLiveMikey  Před 10 lety

      What does the error say?

    • @LongLiveMikey
      @LongLiveMikey  Před 10 lety

      Also make sure there are semi-colons on all lines

    • @the_greck
      @the_greck Před 8 lety

      +After Effects Tutorials w/ Mikey To continue this conversation from a year ago for him,
      he's right. The expression in your description doesn't work because for
      some reason when you copy/paste it from the CZcams page, there's a dash
      in the middle of the word "Math" in the last line (which strangely
      isn't actually visible in the description), but if you take the
      dash out, everything works.

    • @josephburton4751
      @josephburton4751 Před 8 lety

      Ok. Thankyou.

  • @amysch7879
    @amysch7879 Před 4 lety

    wow.... I thought we can just move the rotate anchor point or something....

  • @cessers
    @cessers Před 10 lety

    Dude. How did you round the square corners so easily??

    • @cessers
      @cessers Před 10 lety

      OMG, just double click the rounded rectangle tool! THAT was worth the price of admission. I never knew that!

    • @LongLiveMikey
      @LongLiveMikey  Před 10 lety +1

      one of the mask shapes is a rounded square. I just selected that shape and double clicked on the square.

    • @cessers
      @cessers Před 10 lety

      ***** Figured that out moments after asking (that'll teach me). Thanks, Mike!

  • @johanvanheerden1
    @johanvanheerden1 Před rokem

    Hey Mikey, not sure if something has changed with the latest release of AE since you posted this but the expression returns an error - couldn't turn result into numeric value. Have followed all your steps so not sure what's causing the issue.

    • @Skymography
      @Skymography Před rokem +1

      Try thisLayer.width/2 for the w variable :)

  • @ItsAlexbruh
    @ItsAlexbruh Před 5 lety

    it doesn't work for me... when i copy and paste it from the desc it comes up with an error saying it couldn't turn result into numeric value

    • @the_greck
      @the_greck Před 5 lety

      Yeah it's weird, this worked for me in previous versions of AE, but it looks like something changed that broke this expression.

    • @larusmarinus
      @larusmarinus Před 4 lety

      Use the width value from rectangle path. w=content("Rectangle Path 1").size[0]/2

    • @kamildziubczyk736
      @kamildziubczyk736 Před 4 lety +1

      Same here ;/ Did you guys find what should we put as w? content("rectangle path") doesn't work for me ;c

    • @dolcevita8360
      @dolcevita8360 Před 2 lety +1

      File > Project Settings > Expressions > Legacy ExtendScript

    • @YvonneFrindle
      @YvonneFrindle Před rokem

      @@dolcevita8360 Thank you!

  • @oscand9512
    @oscand9512 Před 9 lety +4

    Thanks Mikey it's a lot of fun learning from you.
    I found another way to do it without trigo just by moving the anchorPoint and position I adapted an expression found on this thread on Creative Cow : forums.creativecow.net/thread/227/22936 (Dan Ebberts answer).
    It works for square and rectangle you can change the solid width and height and/or the scale.
    Put this on the anchorpoint property:
    sclWidth=transform.scale.value[0]/100;
    sclHeight=transform.scale.value[1]/100;
    count = Math.floor(rotation / 90);
    val = count % 4;
    switch (val) {
    case 0:
    [width, height];
    break;
    case 1:
    case -3:
    [width, 0];
    break;
    case 2:
    case -2:
    [0, 0];
    break;
    case 3:
    case -1:
    [0, height];
    break;
    }
    This on position:
    sclWidth=transform.scale.value[0]/100;
    sclHeight=transform.scale.value[1]/100;
    val = Math.floor(rotation / 90);
    a = Math.abs(val%2);
    b = Math.floor(val/2);
    value + [(a+b)*height*sclHeight+b*width*sclWidth,0];
    Animate the rotation.
    Enjoy
    OS

    • @brunografia
      @brunografia Před 9 lety

      Thank you so much, os cand!
      I tried to apply the expression from the video description, but got the same error on line 8 as The Pixel Perfectionist. The good things about your expression are:
      1. It's applied to only one layer - so you can create a preset to apply to other layers in other projects;
      2. It follows the layer scale distortions - apply to squares and rectangles;
      3. It actually works on my project!
      But I'd still like to thank After Effects Tutorials w/ Mikey, since without this great tut I wouldn't have found the means to do it!
      Cheers!

    • @JDHorton
      @JDHorton Před 7 lety

      This is excellent! Thanks a lot

    • @funside7662
      @funside7662 Před 2 lety

      not working on my square, i applied exact same expressions from your comment

  • @atakancalskan
    @atakancalskan Před 5 lety

    What does math work for in real life? Here is the answer

  • @bloodne
    @bloodne Před 10 lety

    Its easier with Newton. ;)

    • @LongLiveMikey
      @LongLiveMikey  Před 10 lety

      Does Newton do square rolling? I knew it did wheels.