css-animations

CSS/JS: Change opacity on swipe

ぃ、小莉子 提交于 2020-08-25 04:05:19
问题 I want to change the opacity of an element while swiping on it. I would like to achieve an animation similar to the one in the snippet, that is applied gradually depending on how much my finger/cursor has dragged the element while swiping. EDIT: The animation is the same as clearing a notification in Android My first idea has been to handle the drag event and change the opacity depending on the position of the element and the width of the screen. Is this a good solution? Is there a better one

How to show CSS loader while syncronous JavaScript is running

穿精又带淫゛_ 提交于 2020-08-23 04:14:25
问题 Based on my own experience, and consistent with this answer, changes to the UI aren't made while JavaScript code is running. Example When I click a button "Run Script", I want a loading animation to appear, then I want some JavaScript to run, and when the JavaScript is finished running, I want the loading animation to disappear. I've created a codepen here, which (predictably) fails. The most relevant portion of code is: $('#run-script-btn').on('click', function() { startLoading();

How to show CSS loader while syncronous JavaScript is running

≡放荡痞女 提交于 2020-08-23 04:11:21
问题 Based on my own experience, and consistent with this answer, changes to the UI aren't made while JavaScript code is running. Example When I click a button "Run Script", I want a loading animation to appear, then I want some JavaScript to run, and when the JavaScript is finished running, I want the loading animation to disappear. I've created a codepen here, which (predictably) fails. The most relevant portion of code is: $('#run-script-btn').on('click', function() { startLoading();

How do I integrate a background JS animation into my react app?

三世轮回 提交于 2020-08-06 06:41:49
问题 I'm trying to add a firefly animation into a component within react (and the code I'm trying to use is here https://codepen.io/celli/pen/xZgpvN). If I had a simple HTML / CSS / Javascript setup I'd know what to do, but I'm confused on how to integration this animation in the context of React and in the scope of a single component. Where do I put the code below? How do I reference it within the component? var total=40, container=document.getElementById('container'), w=window.innerWidth, h

How do I integrate a background JS animation into my react app?

北战南征 提交于 2020-08-06 06:41:45
问题 I'm trying to add a firefly animation into a component within react (and the code I'm trying to use is here https://codepen.io/celli/pen/xZgpvN). If I had a simple HTML / CSS / Javascript setup I'd know what to do, but I'm confused on how to integration this animation in the context of React and in the scope of a single component. Where do I put the code below? How do I reference it within the component? var total=40, container=document.getElementById('container'), w=window.innerWidth, h

Animation with css that changes on click

青春壹個敷衍的年華 提交于 2020-08-05 04:18:12
问题 I’ m doing an animation for a website. My client wants a row with some images. These images have to translate constantly on load, but when I click in the row, the images must accelerate as an exponential function for 4 seconds: after that, the website must change page. Yesterday I have created the animation, changing the animation-duration every some millis by an hook, that strategy was working perfectly, but I don’t like that because it seems to be too heavy. Now I have found another