Hi guys I am new here and have a problem.
So no hate please.
I have here an animation that swings every 2.5s.
However, this should also swing when I hover over it.
However, only one of the two goes.
What have I done wrong?
Could someone help?
Thanks in advance
The animation's transform will overwrite the one in :hover. It will not apply any meaningful change.
There's a couple of options to work around that:
Replace the animation, when a new animation is applied, this enforces a restart of the animation
Add a wrapper and animate that
The wrapper might as well be invisible (without padding/border/background).
And you might want to remove the animation of the child so it doesn't double animate.
.contact_example__mover {
display: flex;
flex-direction: column;
transform-origin: top center;
transform-style: preserve-3D;
animation: swing ease-in-out 1.5s infinite alternate;
}
.contact_example__mover.overwrite-animation:hover {
animation: swing-hover ease-in-out 1.5s infinite alternate;
}
.wrapper {
display: inline-block;
transition: transform .25s;
transform-origin: top center;
transform-style: preserve-3D;
padding: .5rem;
background-color: teal;
}
.wrapper:hover {
transform: rotate(-45deg);
}
.wrapper.and-remove-animation:hover .contact_example__mover {
animation: none;
}
#keyframes swing {
0% {
transform: rotate(0deg);
}
20% {
transform: rotate(-45deg);
}
40% {
transform: rotate(0deg);
}
100% {
transform: rotate(0deg);
}
}
#keyframes swing-hover {
0% {
transform: rotate(0);
}
20% {
transform: rotate(-45deg)
}
40% {
transform: rotate(0deg);
}
100% {
transform: rotate(0deg);
}
}
.contact_example__mover {
background-color: olive;
padding: 1rem;
text-align: center;
color: bisque;
width: 4rem;
height: 4rem;
}
Overwrite with similar animation:
<div class="contact_example__mover overwrite-animation">set new animation</div>
<br>
<br> Add wrapper and transform that.<br>
<div class="wrapper">
<div class="contact_example__mover">wrap with animation</div>
</div>
<br>
<br> Add wrapper and also remove animation from child. <br>
<div class="wrapper and-remove-animation">
<div class="contact_example__mover">wrap with animation</div>
</div>
How can I get this animation effect? I mean exacly this one:
I have to animate the image (I have every part of it in layers). What I should use? which way is the best?
i hope this can help,i use animation on load event using jQuery.
$( window ).on( "load", function() {
$('.main-section').toggleClass('animation-effect');
});
body {
margin: 0;
}
.main-section {
padding: 25px 0px 0 20px;
background-color: #d7f0f7;
}
.main-section .content {
max-width: 450px;
background-color: #d7f0f7;
transform: translateX(-500px);
transition: 0.8s;
}
.main-section .content .box {
height: 150px;
background-color: #e91e63;
margin-top: -15px;
transition: 0.5s;
width: 0;
}
.main-section .content .leaf {
padding-left: 100px;
}
.main-section .content .half-circle {
padding-left: 100px;
margin-top: -20px;
}
.main-section .content .half-circle-2 {
padding-left: 100px;
margin-top: -25px;
transform: rotate(-14deg);
}
.main-section .content .leaf img {
padding-left: 115px;
}
.main-section.animation-effect .content{
transform: translateX(0px);
transition: 1s;
}
.main-section.animation-effect .box {
width: 100%;
transition: 1s;
}
.main-section .content .half-circle img {
animation: rotate 3.5s infinite;
}
.main-section .content .leaf img {
animation: leaf-animation 3s infinite;
}
#keyframes rotate {
0% {
transform: rotate(-14deg);
}
50% {
transform: rotate(10deg);
}
100%
{
transform: rotate(-14deg);
}
}
#keyframes leaf-animation {
0% {
transform: rotate(0);
}
50% {
transform: rotate(3deg);
}
100% {
transform: rotate(0deg);
}
}
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<div class="main-section">
<div class="content">
<div class="leaf">
<img src="https://i.ibb.co/fSQXHD5/leaf.png" alt="leaf" border="0">
</div>
<div class="half-circle">
<img src="https://i.ibb.co/xfmy6zS/half-1.png" alt="half-1" border="0">
</div>
<div class="half-circle-2">
<img src="https://i.ibb.co/CBdVwNC/half-2.png" alt="half-2" border="0">
</div>
<div class="box">
</div>
</div>
</div>
Hi guys I have a problem. I want show just normal my text on the image. When I do mouseover should be change image opacity except my text and png icon, it's should be seen normal (without opacity ).Like that.Thanks http://demo.digipieces.com/gusteau-html/menu-1.html
.foodMenu {
text-align: center;
height: 210px;
width: 280px;
position: relative;
}
.foodMenu:after {
content:'\A';
position:absolute;
background:rgba(0,0,0,0.6);
opacity:0;
transition: all 0.5s;
-webkit-transition: all 0.5s;
top:0;
left:0;
width:100%; height:100%;
}
.foodMenu:hover:after {
opacity: 1;
}
.foodMenu .menuTitle {
font-weight: 300;
font-size: 32px;
text-align: center;
text-transform: none;
position: absolute;
bottom:30px;
left:0;
right:0;
transition:all 0.4s ease-in-out;
-webkit-transition:all 0.4s cubic-bezier(x1,y1,x2,y2);
text-rendering: optimizelegibility;
opacity: 0;
}
.foodMenu:hover .menuTitle {
opacity: 1;
bottom: 70px;
}
.foodMenu .curve {
text-align: center;
text-transform: none;
position:absolute;
bottom:70px;
left:120px;
right:0;
opacity:0;
transition:all 0.4s ease-in-out;
-webkit-transition:all 0.4s;
}
.foodMenu:hover .curve {
opacity: 1;
}
<div class="col span-1-of-4 step_box">
<div class="foodMenu js-wp-2">
<img src="http://lorempixel.com/output/food-q-c-280-210-1.jpg" alt="our menu meal">
<h3 style="color:#ffffff;" class="menuTitle">Meals</h3>
<img src="img/curve.png" alt="curve" class="curve">
</div>
</div>
Inspired by native Android zoomOut for form transitions and iOS app launching zoom effect, which are both really cool...
How do I go about implementing zoom In or Out transition for Forms, Dialogs and Containers in Codenameone?
I want the transition to have zooming animation like below:
#charset "UTF-8";
*,
:before,
:after {
margin: 0;
padding: 0;
position: relative;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
input,
select,
button,
textarea {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
font: inherit;
color: inherit;
}
.butt,
.input {
padding: .75rem;
margin: .375rem;
background-color: transparent;
border-radius: 4px;
}
.butt:focus,
.input:focus {
outline: none;
}
.butt {
border: 2px solid #f35626;
line-height: 1.375;
padding-left: 1.5rem;
padding-right: 1.5rem;
font-weight: 700;
color: #f35626;
cursor: pointer;
-webkit-animation: hue 60s infinite linear;
}
.butt--primary {
background-color: #f35626;
color: #fff;
}
.input {
border: 1px solid #c0c8c9;
border-radius: 4px;
}
.input--dropdown {
background-image: url("images/ddown.png");
background-image: url("images/ddown.svg?3"), none;
background-repeat: no-repeat;
background-size: 1.5rem 1rem;
background-position: right center;
}
h1,
.alpha {
margin-bottom: 1.5rem;
font-size: 3rem;
font-weight: 100;
line-height: 1;
letter-spacing: -.05em;
}
h2,
.beta {
margin-bottom: .75rem;
font-weight: 400;
font-size: 1.5rem;
line-height: 1;
}
#media (min-width: 650px) {
.mega {
font-size: 6rem;
line-height: 1;
}
}
.subhead,
.meta {
color: #7b8993;
}
.promo {
text-align: center;
}
p,
hr,
form {
margin-bottom: 1.5rem;
}
hr {
border: none;
margin-top: -1px;
height: 1px;
background-color: #c0c8c9;
background-image: -webkit-linear-gradient(0deg, #fff, #c0c8c9, #fff);
}
a {
color: inherit;
text-decoration: underline;
-webkit-animation: hue 60s infinite linear;
}
a:hover {
color: #f35626;
}
.wrap {
max-width: 38rem;
margin: 0 auto;
}
.island {
padding: 1.5rem;
}
.isle {
padding: .75rem;
}
.spit {
padding: .375rem;
}
html {
font: 100%/1.5"Roboto", Verdana, sans-serif;
color: #3d464d;
background-color: #fff;
-webkit-font-smoothing: antialiased;
width: 100%;
overflow: hidden-x;
text-align: center;
}
#media (min-width: 650px) {
html {
height: 100%;
}
html:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
margin-right: -0.25em;
}
body {
display: inline-block;
vertical-align: middle;
max-width: 38rem;
}
}
.site__header {
-webkit-animation: bounceInUp 1s;
}
.site__title {
color: #f35626;
background-image: -webkit-linear-gradient(92deg, #f35626, #feab3a);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-animation: hue 60s infinite linear;
}
.site__content {
-webkit-animation: bounceInUp 1s;
-webkit-animation-delay: .1s;
}
.site__content form {
-webkit-animation: bounceInUp 1s;
-webkit-animation-delay: .1s;
}
.animated {
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.animated.infinite {
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
.animated.hinge {
-webkit-animation-duration: 2s;
animation-duration: 2s;
}
.animated.bounceIn,
.animated.bounceOut {
-webkit-animation-duration: .75s;
animation-duration: .75s;
}
.animated.flipOutX,
.animated.flipOutY {
-webkit-animation-duration: .75s;
animation-duration: .75s;
}
#-webkit-keyframes zoomIn {
from {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
50% {
opacity: 1;
}
}
#keyframes zoomIn {
from {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
50% {
opacity: 1;
}
}
.zoomIn {
-webkit-animation-name: zoomIn;
animation-name: zoomIn;
}
#-webkit-keyframes zoomOut {
from {
opacity: 1;
}
50% {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
to {
opacity: 0;
}
}
#keyframes zoomOut {
from {
opacity: 1;
}
50% {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
to {
opacity: 0;
}
}
.zoomOut {
-webkit-animation-name: zoomOut;
animation-name: zoomOut;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, minimal-ui" />
<link rel="dns-prefetch" href="//fonts.googleapis.com" />
<link rel="dns-prefetch" href="//code.jquery.com" />
<link href='//fonts.googleapis.com/css?family=Roboto:400,100,400italic,700italic,700' rel='stylesheet' type='text/css'>
</head>
<body>
<header class="site__header island">
<div class="wrap">
<span id="animationSandbox" style="display: block;"><h1 class="site__title mega">Zoom me in and out</h1></span>
</div>
</header>
<!-- /.site__header -->
<main class="site__content island" role="content">
<div class="wrap">
<form>
<select class="input input--dropdown js--animations">
<optgroup label="Zoom Entrances">
<option value="zoomIn">zoomIn</option>
</optgroup>
<optgroup label="Zoom Exits">
<option value="zoomOut">zoomOut</option>
</optgroup>
</select>
<button class="butt js--triggerAnimation">Animate it</button>
</form>
<hr />
</div>
</main>
<!-- /.site__content -->
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script>
function testAnim(x) {
$('#animationSandbox').removeClass().addClass(x + ' animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
$(this).removeClass();
});
};
$(document).ready(function() {
$('.js--triggerAnimation').click(function(e) {
e.preventDefault();
var anim = $('.js--animations').val();
testAnim(anim);
});
$('.js--animations').change(function() {
var anim = $(this).val();
testAnim(anim);
});
});
</script>
</body>
</html>
Probably the closest thing to some of the Android effects is the Morph transition between forms that allows a component to grow into the next form http://www.codenameone.com/blog/mighty-morphing-components.html
If you want something closer to the above code you can just position the component in the right location and make it smaller then use animateLayout() to make it grow into place.
In the old days we had a FlyIn transition which mapped to this exactly but it used old 3D code. I think it should be trivial to implement though with the affine transform and scale similarly to the FlipTransition.
I have a problem with a image I added to the header It doesn't seem to display in Chrome but is does display on Safari and Firefox. I have 3 black banners/flags on the top left of the screen. The middle doesnt display on chrome. Does anyone have a suggestion or an idea why it doesn't display?
header.php:
<div class="header_inner clearfix">
<div class="marketing-top">
<img src="/wp-content/uploads/2015/04/Banner-header-marketing.png" alt="marketing">
<img class="space" src="/wp-content/uploads/2015/04/Banner-header-design.png" alt="design">
<div class="header-img animated swing">
<img src="/wp-content/uploads/2015/05/banner-header-web-design.jpg" alt="webdesign">
</div>
</div>
css:
.marketing-top {
padding-left: 180px;
position: absolute;
float: left;
left: 100px;
}
.marketing-top .space{
position: absolute;
float:left;
left:280px;
bottom:57px;
}
.header-img {
position: absolute;
float:left;
left:230px;
bottom:0px;
}
#media screen and (max-width: 1250px) {
.marketing-top{
display: none;
}
}
.swing {
animation-name: swing;
transform-origin: center top 0;
}
.animated {
animation-duration: 5s;
animation-iteration-count: infinite;
animation-timing-function: ease-in-out;
}
#keyframes swing {
0% {
transform: rotate(0deg);
animation-timing-function: ease-in-out;
}
20% {
transform: rotate(1deg);
animation-timing-function: ease-in-out;
}
40% {
transform: rotate(-1deg);
animation-timing-function: ease-in-out;
}
60% {
transform: rotate(0.5deg);
animation-timing-function: ease-in-out;
}
80% {
transform: rotate(-0.5deg);
animation-timing-function: ease-in-out;
}
100% {
transform: rotate(0deg);
animation-timing-function: ease-in-out;
}
}
Thanks in advance!
Vonwelzen
Related URL: http://www.elephantdesign.nl
6 hours ago
Its because width of .header-img is 0 in your case. Explicitly assign a width greater than image width
.header-img{
width:50px;
}