TVL Comprog11 Q2 M3
TVL Comprog11 Q2 M3
Technical Vocational
Livelihood
QUARTER
2 Computer Programming
Republic Act 8293, section 176 states that: No copyright shall subsist in
any work of the Government of the Philippines. However, prior approval of the
government agency or office wherein the work is created shall be necessary for
exploitation of such work for profit. Such agency or office may, among other things,
impose as a condition the payment of royalties.
Quarter 2
Self Learning Module 3
CSS Transition and Animation
Writer: Jenessy Joy T. Pinga
Editors: Ma.Lerma I. Cantanero
Validator/ Reviewer: Rowena O. Dimagiba
Introductory Message
Welcome to the Computer Programming for the ICT Module on CSS Transition and
Animation!
This module was collaboratively designed, developed and reviewed by educators from
Schools Division Office of Pasig City headed by its Officer-In-Charge Schools Division
Superintendent, Ma. Evalou Concepcion A. Agustin in partnership with the Local
Government of Pasig through its mayor, Honorable Victor Ma. Regis N. Sotto.
The writers utilized the standards set by the K to 12 Curriculum using the Most
Essential Learning Competencies (MELC) while overcoming their personal, social,
and economic constraints in schooling.
This learning material hopes to engage the learners into guided and independent
learning activities at their own pace and time. Further, this also aims to help learners
acquire the needed 21st century skills especially the 5 Cs namely: Communication,
Collaboration, Creativity, Critical Thinking and Character while taking into
consideration their needs and circumstances.
In addition to the material in the main text, you will also see this box in the body of
the module:
As a facilitator you are expected to orient the learners on how to use this module.
You also need to keep track of the learners' progress while allowing them to manage
their own learning. Moreover, you are expected to encourage and assist the learners
as they do the tasks included in the module.
For the Learner:
Welcome to the Computer Programming for the ICT Module on CSS Transition and
Animation!
The hand is one of the most symbolized part of the human body. It is often used to
depict skill, action and purpose. Through our hands we may learn, create and
accomplish. Hence, the hand in this learning resource signifies that you as a learner
is capable and empowered to successfully achieve the relevant competencies and
skills at your own pace and time. Your academic success lies in your own hands!
This module was designed to provide you with fun and meaningful opportunities for
guided and independent learning at your own pace and time. You will be enabled to
process the contents of the learning material while being an active learner.
Lesson- This section will discuss the topic for this module.
Post-test - This will measure how much you have learned from
the entire module. Ito po ang parts ng module.
EXPECTATION
PRE–TEST
RECAP
Module 2 discussed CSS transform, now describe the following below on how
you understand the lesson.
• rotateX()
• rotateY()
• translate()
• rotate()
• scale()
• skewX()
• skewY()
• matrix()
LESSON
CSS Transitions
Transitions allow you to change property values from one value to another,
over a given duration. To create a transition, you must specify at least two things,
the name of the CSS property to which you want to apply the transition effect using
the transition-property and the duration of the transition effect using the
transition-duration. Other transition properties are optional.
• ease - specifies a transition effect with a slow start, then fast, then
end slowly.
• linear - specifies a transition effect with the same speed from start to
end.
• ease-in - specifies a transition effect with a slow start.
• ease-out - specifies a transition effect with a slow end.
• ease-in-out - specifies a transition effect with a slow start and end.
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 100px;
height: 100px;
background: yellow;
transition: width 2s;}
#div1 {transition-timing-function: linear;}
#div2 {transition-timing-function: ease;}
#div3 {transition-timing-function: ease-in;}
#div4 {transition-timing-function: ease-out;}
#div5 {transition-timing-function: ease-in-out;}
div:hover {width: 400px;}
</style>
</head>
<body>
<div id="div1">linear</div><br>
<div id="div2">ease</div><br>
<div id="div3">ease-in</div><br>
<div id="div4">ease-out</div><br>
<div id="div5">ease-in-out</div><br>
</body>
</html>
</html>
Example2: using four properties (to see what happens try it with your PC)
div {
transition-property: width;
transition-duration: 2s;
transition-timing-function: linear;
transition-delay: 1s;
}
div {
transition: width 2s linear 1s;
}
CSS Animations
An animation allows an element gradually change from one style to
another. To make an animation, you must first specify keyframes for the
animation. Keyframes hold what styles the element will have at the certain
times.
@keyframes
When you specify CSS styles inside the @keyframes, the animation
will gradually change from the current style to the new style at certain time.
• ease - specifies an animation with a slow start, then fast, then end slowly.
• linear - specifies an animation with the same speed from start to end.
• ease-in - specifies an animation with a slow start.
• ease-out - specifies an animation with a slow end.
• ease-in-out - specifies an animation with a slow start and end.
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 100px;
height: 100px;
background-color: yellow;
font-weight: bold;
position: relative;
animation: sample 10s infinite;
}
#div1 {animation-timing-function: linear;}
#div2 {animation-timing-function: ease;}
#div3 {animation-timing-function: ease-in;}
#div4 {animation-timing-function: ease-out;}
#div5 {animation-timing-function: ease-in-out;}
@keyframes sample {
from {left: 0px;}
to {left: 300px;}
}
</style>
</head>
<body>
<div id="div1">linear</div>
<div id="div2">ease</div>
<div id="div3">ease-in</div>
<div id="div4">ease-out</div>
<div id="div5">ease-in-out</div>
</body>
</html>
div {
animation-name: sample;
animation-duration: 5s;
animation-timing-function: linear;
animation-delay: 1s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
Or using shorthand property
div {
animation: sample 5s linear 1s infinite alternate;
}
ACTIVITIES
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 100px;
height: 100px;
position: relative;
background-color: yellow;
animation-name: example;
animation-duration: 5s;
}
@keyframes sample {
}
</style>
</head>
<body>
<div></div>
</body>
</html> </html>
1. Add the following 5 steps to the animation "sample" (using 0%, 25%, 50%,
75%, and 100%):
2. Using the transition shorthand property, specify width changes for the <div>
element should have: "5" second duration, transition effect with a slow start,
and a "1" second delay before starting.
3. Using four transition properties, specify width changes for the <div> element
should have: "5" second duration, transition effect with a slow start, and a "1"
second delay before starting.
*Answer the Worksheet number 2 and submit a soft copy/hard copy of your
completed activity to your subject teacher on the following meeting.
WRAP–UP
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
VALUING
2. How will you use the knowledge you acquired in this module?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
POST TEST