Animating with CSS Transitions - A look at the transition properties

Sdílet
Vložit
  • čas přidán 27. 08. 2024

Komentáře • 290

  • @mountains_and_stuff
    @mountains_and_stuff Před 4 lety +19

    The tips on Javascript using ms and the CPU/GPU strain of certain animations is gold. Thank you!

  • @NeroIvanY
    @NeroIvanY Před 6 lety +49

    Finally! I have understand the difference between all these 'ease' transitions! Thank you, Kevin!

    • @KevinPowell
      @KevinPowell  Před 6 lety +5

      Awesome, glad the video helped clear that up Ivan!

  • @planttherapyph2817
    @planttherapyph2817 Před 4 lety +5

    For a while, I've been so confused when to use keyframes and transitions, but thanks for this! Finally, I understood it so much better!
    "Transitions require a trigger to run. The trigger may be one of the events listed in the last section or it might be JavaScript, but the transition needs something outside itself to start.
    CSS animations don’t need a trigger. They can respond to a trigger, but one isn’t needed to start the animation. Animations can run automatically when the page first loads. If you need your elements to change or move automatically, you have only one choice: animations.
    Transitions are limited to an initial and final state. Animations can include as many intermediate states (keyframes) as desired in between the initial and final states. This gives you more control over CSS animations and lets you create more complex animations. Transitions work better for simpler animations.
    Transitions can’t change CSS properties. You set the property values on a selector and perhaps the selector’s :hover state. The transition defines how the change occurs, but not the specific start and end values.
    Animations, on the other hand, can change property values inside their keyframes. The property values don’t even need to exist outside of the animation keyframes. This makes animation far more dynamic and flexible than transitions.
    Transitions can’t loop. They run when triggered and then run in reverse when the trigger is removed. Animations can loop as many times as you want. They can run forward or in reverse, or they can alternate between the two. Once again, CSS animations offer more refined control.
    I’m probably making it sound as though you should always choose animations. Transitions have their good side, too. Transitions are typically easier and quicker to work with. This is especially true if you use JavaScript to give yourself a little more control. For example, it’s easier for JavaScript to make changes to intrinsic property values than to property values inside animation keyframes.
    As a general rule, you’ll write more code using CSS animations than you will using CSS transitions, assuming both are attempting to do the same thing. However, if you find yourself writing the same transition code over and over, you might want rewrite it as a single keyframe animation that can be easily added to a number of different elements."

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

    Kevin's channel and webdevsimplified are the absolute best!

  • @atarixle
    @atarixle Před 6 lety +2

    I used transitions for quite a long time now, but as they say:"Every Day You Learn Something New". Thank you for teaching me cubic-bezier and transition-delay. Together this your Video "::before and ::after" (Part 2) I replaced a JavaScript function with CSS only. Keep making such great videos!

    • @KevinPowell
      @KevinPowell  Před 6 lety +1

      So glad to hear that my videos have helped you out atarixle!

  • @flaviucristian3658
    @flaviucristian3658 Před 3 lety +8

    For a junior full-stack dev I found your videos very useful. You are explaining new concepts really well. Keep up the good work

  • @huguolin2543
    @huguolin2543 Před 5 lety +7

    Just great. You're my mentor in CSS. Humble, kind and the stuff. Thanks Kevin.

  • @facundocorradini
    @facundocorradini Před 6 lety +204

    oh c'mon, with such a great content you're forcing me to click that thumbs up button on every video you upload by now.

  • @sinc1802
    @sinc1802 Před 3 lety +2

    Although It's been like 3 years since this video was released, but because of you, I have found a treasure chest in my browser's dev tools (yes I was talking about that curve thingy). Thank you :)

  • @borisbosnjak9772
    @borisbosnjak9772 Před 5 lety +5

    This is the first time I am seeing this cubic-bezier value...It's so helpfull and fun to play with. Thank you!

  • @joeldcanfield_spinhead
    @joeldcanfield_spinhead Před 5 lety +7

    Especially appreciate the insight into CPU/GPU usage. Some of us (ahem*me*ahem) like to, as someone said in this video, animate everything. I"m also learning a lot about the inspector in Chrome; so much I didn't realize I was missing.

    • @ayanarko8890
      @ayanarko8890 Před 3 lety

      If you like animation using image , 2d , 3d animated arbitrary shape using html. i will suggest ..Coding techno oregano channel..
      czcams.com/video/CFAmhyEB1Jw/video.html
      czcams.com/video/JtS6N_z233A/video.html -- sliding effect

  • @DustinHein
    @DustinHein Před 3 lety

    kevin powell was the name of one of my hockey heroes when i was a kid. great videos!

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

    One of the Gems I watch everyday

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

    Its my first time playing with transitions and you help me a lot, thank!

  • @cleitonandrade8802
    @cleitonandrade8802 Před 3 lety

    Best tutorial I found on CSS transitions.

  • @d.o.nmuzic3802
    @d.o.nmuzic3802 Před 4 lety +15

    KEVIN !!!!!!! This simple and clear break down was so good! I just started trying to learn css two days ago. Your simple breakdown really help me get a good understanding. Thank you! Do you have something like this for css grid/and or positioning? I really appreciate this tutorial!

    • @KevinPowell
      @KevinPowell  Před 4 lety +5

      I have one that looks at position absolute. My grid videos are a little all over the place, but the playlist I have on it should help get you started with it :)

  • @akashkhatri4652
    @akashkhatri4652 Před 5 lety +6

    Thank you so much for this! I really hope you make some backend related videos as well, like PHP, Laravel etc. You make it really easy to understand things.

    • @KevinPowell
      @KevinPowell  Před 5 lety +7

      Sorry to disapoint, but I'm not a backend guy at all, so that won't be happening :(
      I'm glad that you like how I explain things though!

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

      @@KevinPowell im currently learning frontend yet my teacher couldnt explain me everything but you did better job than him i understood better now i can practice on it ...is there more vids about transitions and stuff ?

  • @casperr3717
    @casperr3717 Před 3 lety +1

    Thankyou Kevin for the clear explanation!. For everyone who wants to remember the transition-timing-function (6:44) I thought about the following: The subject is your home just remember around the house u are quick when leaving u are in hurry, When arriving back home u are late so running in the home also. This makes the values mean:
    Ease-in = u start walking slowly but when u arrive u race inside.
    Ease-out = u leave the house in a hurry; running and then continue walking slowly.
    Ease-in-out = combine above! (the home is the running part again). Just like the mailmen that approach the house with the mean guard dogs; u walk slowly run to that house and run away to walk slowly again.
    Linear = without a house. Just a slow and steady walk true town.

  • @revillsimon
    @revillsimon Před 6 lety

    Just like the amp/filter envelopes on a synthesizer... If you're a musician, you'll already understand it. For me, this was a bonus!

    • @KevinPowell
      @KevinPowell  Před 6 lety +1

      That's really awesome that it's the same, I had no idea! I'm very musically challenged, lol.

    • @revillsimon
      @revillsimon Před 6 lety

      At the moment I'm discovering from my background in music and music technology that there are many parallels between coding, design, development, music, and music production. Concepts like layering, timing functions like this and also the mathematical side of things, feel very familiar to me. Thanks for another great video Kevin.

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

    Transition-timing-function example was fun.

  • @DarkCebolix
    @DarkCebolix Před 2 lety

    Jesus, even when I'm seeing a random css video I realize that it is a video made by Kevin Powell!! Lol. Good job! Tks.

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

    Great Content Kevin... Well detailed and crisp explanations.

  • @WagnerLoch01
    @WagnerLoch01 Před 5 lety +3

    Excellent video, thank you from Brazil!!!

  • @dennyd2724
    @dennyd2724 Před 5 lety

    Fantastic! i learned keyframing, but more and more i stood up on transitions, by looking in sample projects exc~ "study on freecodecamp, and they discovered more keyframing for me, then transitions" and i was like.. wow... aniway long story short: i typed in my search :: Transition Kevin powell. and yep you got it! Your'e my favorite teacher!!!!! And thnx! i just learned the basics, no wait the whole subject in 17minutes! Your'e to good for this world!!!! stay following you.

  • @actrox1
    @actrox1 Před 2 lety

    Thank you for this general understanding, it is helpful for beginners.

  • @Amin-kg8rm
    @Amin-kg8rm Před 3 lety

    this man a true legend and a great techer

  • @wojciechjarosz420
    @wojciechjarosz420 Před 4 lety +5

    amazing job man! You should be a milioner with this quality of content xD

  • @aliturab5370
    @aliturab5370 Před 3 lety

    love you man
    your amazing you fixed something I was scratching my head on for quiet some while

  • @JorgeRivera-rp1zw
    @JorgeRivera-rp1zw Před 3 lety

    What should I say..!?
    Simple Awesome..! Really thanks to you..to share your videos..!
    The King of code..!
    And great person you are..!

  • @abguven
    @abguven Před 3 lety

    Thanks for your time Kevin.Very good tutorial.

  • @-Desire
    @-Desire Před 5 měsíci

    Thank you so much for this vidoe! Helpful and fun!

  • @sebastianiuga3020
    @sebastianiuga3020 Před 4 lety

    Very interesting video Kevin, addressing some points few people talk about.
    Thank you!

  • @joeypanganiban
    @joeypanganiban Před 3 lety

    Thank you, Kevin!

  • @CamaguNcoso
    @CamaguNcoso Před měsícem

    HTML and CSS are now the food I eat. I'm a beginner

  • @muhammadumer2011
    @muhammadumer2011 Před 5 lety +4

    Exellent tutorial sir ! thanks for these amazing knowledgeable tutorials.:)

  • @thecorleone8777
    @thecorleone8777 Před rokem

    You deserve my subscription

  • @adamwoolf9993
    @adamwoolf9993 Před 3 měsíci

    Nice presentation! Thanks.

  • @narco7765
    @narco7765 Před 5 lety +11

    awesome tutorial and i cracked up when you repeated your outro lol. leaving a like and sub

  • @salo1052
    @salo1052 Před 4 lety

    great pen on the timing-function, very illustrative 👍

  • @ayuba333abdeta8
    @ayuba333abdeta8 Před 2 lety

    hey Mr. Genius i proud of u and God bless u

  • @knotcircle2844
    @knotcircle2844 Před 3 lety

    4:37 Why explicitly defining transition-property is encouraged

  • @gilbertr3651
    @gilbertr3651 Před 6 lety +1

    Great video man, you've earned a subscriber!

    • @KevinPowell
      @KevinPowell  Před 6 lety +1

      Glad you liked it Gilbert, and thanks for subbing!

  • @hamedwahabzada5279
    @hamedwahabzada5279 Před 7 měsíci

    In my vs code transition-property does't know about transform what should i do?
    It can accept all but does't apply transform

  • @daynablackwell5885
    @daynablackwell5885 Před 5 lety +2

    Would it be fair to generalize by saying that 'transform' defines _what_ you will be animating and 'transition' defines _how_ it will be animated (in other words, the properties of the animation itself) ?

    • @KevinPowell
      @KevinPowell  Před 5 lety

      That's a really nice way to think about it.

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

    how did u get your transitions to play simultaneously? I have some that I add/remove a class from with js, but they keep playing in sequence.

  • @A_Lesser_Man
    @A_Lesser_Man Před 4 lety

    oh. didn't know about "all" causing a performance hit. i, stupidly, assumed the engine would see the other properties aren't changing and no bother with those properties. good to know. ty.

  • @shrookwageh5976
    @shrookwageh5976 Před 5 lety +1

    Awesome. this my first time know about cubic-value in Chrome and about "all" and performance. great content as usual. plz try to make a video about transform

  • @courtneyyamanishi-baker2889

    This was super informative, thank you so much!

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

    Hey, Can you tell me, what is the best approach to have responsiveness in terms of feasibility, smoothness and cost of execution, with CSS media queries or java script? I am currently using CSS media queries to hide and unhide elements at different widths ( like changing a div options component to a menu component ), there are a few libraries in react like react-responsive that use HOOKS but where I'm working, I for some reason cannot use hooks.. I can for sure use event handlers and get window width from JS but react rendering is done with every prop/state change (here state could be window width for responsiveness and yes I am using react..) .., I need to make page responsive, which I can via CSS, but when it comes to component level like i have 5 react components which are on different repository I donot have access to.. how can I let them know it's a max-width change and define what they gotta behave as? My question I don't really think is clear.. incase you get it its good, else please let me know, I'll explain further..
    Also I love your videos, I have worked on devops, but your video got me interested in CSS so much. It's do powerful only of people knew..
    Regards :)

  • @co9681
    @co9681 Před 3 lety

    Great explanation

  • @shezzammahi9136
    @shezzammahi9136 Před 3 lety

    My question is "What will be the syntax or code If I want to put a delay of some seconds only after when I take off my cursor not when I hover ?". What will be the solution?.

  • @mohammedalnamer9758
    @mohammedalnamer9758 Před 3 lety

    thank you for this great video

  • @funterban6536
    @funterban6536 Před 2 lety

    best tutorial thankyou sir

  • @piyushdanej3930
    @piyushdanej3930 Před 3 lety

    Good tutorial !
    but I tried to open the ul on button:hover instead of button:focus , as soon as I leave the button and go to the li , the ul disappears .
    How to fix it ?

  • @WPCliffsNotes
    @WPCliffsNotes Před 6 lety

    Nice tutorial! I love CSS transitions.

    • @KevinPowell
      @KevinPowell  Před 6 lety

      Thanks, glad you liked it! Transitions are super useful in creating better user experiences (and making things look nice!). Too many people focus on trying to do stuff with animations and getting complicated, but a lot can be done with a simple transition

  • @wahseongtan5223
    @wahseongtan5223 Před 6 lety

    Wow, the best explanation !! love your channel

  • @ramazain2264
    @ramazain2264 Před rokem

    could you show us how did you sync the hover over the 4 time-function. because i could not figure out how to have all of them in a one class but have different time-function on each one and still have a one hover tag

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

    Kevin, please, could you make a video on css perspective and mix-blend-mode properties? That would be great

    • @KevinPowell
      @KevinPowell  Před 6 lety +1

      The perspective one is sort of in the works!

  • @pablobarrientos2071
    @pablobarrientos2071 Před 2 lety

    I´m transitioning on web developer with this content =D

  • @xenlithkayo2221
    @xenlithkayo2221 Před 6 lety

    Thank you for making such well made and helpful videos

    • @KevinPowell
      @KevinPowell  Před 6 lety

      No problem at all, glad to hear you liked them Xenlith :)

  • @awantomagaret7390
    @awantomagaret7390 Před 5 lety +1

    Thanks for the video Kevin

  • @0the0ambient0
    @0the0ambient0 Před 4 lety

    Great overview. Thanks!

  • @thilakamn575
    @thilakamn575 Před 3 lety

    Awesome video. Thank you for sharing

  • @hagopderderian6824
    @hagopderderian6824 Před 2 lety

    in inspect i cant find the (transition-timing-function) a little help plz

  • @tube-you-and-me
    @tube-you-and-me Před 2 lety

    great video! thanks a lot

  • @JimKernix
    @JimKernix Před 2 lety

    I'm doing a translateX on an image and an h1 next to the image. I'm using 2000ms and it looks good.

  • @ateeba-mateen
    @ateeba-mateen Před 2 lety

    This cubic bezier isn't working on my laptop. Anyone knows why?

  • @joaomarcelo4940
    @joaomarcelo4940 Před 7 měsíci

    great video, thanks

  • @chrisloach9658
    @chrisloach9658 Před 4 lety

    Why is ease-in not the same a linear on the way out and ease-out not the same as linear on the way in? If that makes sense? Is it just "ease"? In that case what's the difference between "ease" and "ease-in-out"?

  • @nizarazoux7012
    @nizarazoux7012 Před 2 lety

    Helpful, Thankies!!

  • @neofu262
    @neofu262 Před 6 lety +1

    Dman useful , great work and thank u , Kevin!

  • @RameenFallschirmjager
    @RameenFallschirmjager Před 4 lety

    Computers are the greatest humanity achievement yet, and Kevin you are an awesome instructor! I hope a day comes that greedy and stupid politician are being replaced with artist and creators and scientist.

  • @kuntzherald8703
    @kuntzherald8703 Před 4 lety

    thanks Kevin

  • @adityaprasaddhal2462
    @adityaprasaddhal2462 Před 3 lety +1

    thanks a lot buddy

  • @JD-kf2ki
    @JD-kf2ki Před 3 lety

    Cool! Thanx, dude!

  • @bloxzyo
    @bloxzyo Před 4 lety

    I subscribed to uuu.... wooow this video is suuuuuuuper helpful and u definately know the stuff you are talking about!!!!

  • @abigroman
    @abigroman Před 4 lety

    Great physical
    presentation.

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

    THIS IS SO COOL!!! Thank you!

  • @icepack7336
    @icepack7336 Před 5 lety +1

    Hi, Quick Question so I have a box that extends when u hover over it but i want it to, when it expands, make words appear. Is that possible if so please let me know!

    • @KevinPowell
      @KevinPowell  Před 5 lety

      If you set `overflow: hidden`, if you set a height that's smaller than the text, it would hide the text that would spill out the bottom.

  • @lucascubilla869
    @lucascubilla869 Před 5 lety +1

    Amazing, thank you so much!

    • @KevinPowell
      @KevinPowell  Před 5 lety +1

      No problem at all, I'm glad you liked it :)

  • @cafe-tomate
    @cafe-tomate Před 2 lety

    Do you know Kevin / or anyone else how to make an item move when we hover over an other item ? Thanks, regards

  • @rogerruiz1801
    @rogerruiz1801 Před 3 lety

    great job !

  • @comebackrohit.902
    @comebackrohit.902 Před 2 lety +1

    Thanks 👍🙏

  • @mcodes5214
    @mcodes5214 Před 3 lety

    Thanks for the content

  • @Ghillie
    @Ghillie Před rokem

    the first 2 minutes helped me honestly so annoyed it was that easy to pull of what i wanted.

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

    For some reason my transition:all property starts when the page reloads, so every time I reload the page it takes e.g. 1000ms to load the object with its other properties... Pls help

  • @AabaBeel
    @AabaBeel Před rokem

    The FATHER of CSS 😁

  • @soultouchingsongs
    @soultouchingsongs Před 4 lety

    Awesome video 👌. Thank you

  • @DonNjabs
    @DonNjabs Před 2 lety

    can you add transitions of color, width and border radius on one button ?

  • @shorttipsandtricks5501

    Good delivery.

  • @RameenFallschirmjager
    @RameenFallschirmjager Před 4 lety

    Kevin, I've got a question. When should we use animation and when transition?

  • @greenblood5640
    @greenblood5640 Před 2 lety

    I'm relatively new to web development, was this previously only possible with JS?

  • @brucestark4244
    @brucestark4244 Před 2 lety

    Thank You Sir❤

  • @shashankdesai8650
    @shashankdesai8650 Před 2 lety

    Very helpful !
    Thanks a lot

  • @SteveRaynerMakes
    @SteveRaynerMakes Před 2 lety

    thanks, very helpful

  • @ateeba-mateen
    @ateeba-mateen Před 2 lety

    Mr Kevin, first of all, a huge bundle of thanks. I have question! How did you make all those 4 boxes undergo transition at once when you were hovering over only one box at a time? I could not do that.

  • @BobbyBundlez
    @BobbyBundlez Před 4 lety

    when i reload the page it transitions the initial color as well? not just when i hover. your square seems to stay bluy from the beginning

  • @vipulbhardwaj1599
    @vipulbhardwaj1599 Před 3 lety

    amazing video, very informative...

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

    Do you have anything about reordering div from dynamic div collection using transition? Keen to undestand to logic behind that. But great video :D

  • @raistlinmajere2257
    @raistlinmajere2257 Před 3 lety

    Thank You Kevin