Giter VIP home page Giter VIP logo

aframe-gif-component's Introduction

AFrame GIF Component

A conponent to control GIF for A-Frame VR.

Requires aframe-gif-shader.

DEMO

example

Method

Global method

play()

Play gif animation

entity.play()

pause()

Pause gif animation

entity.pause()

Custom method

togglePlayback()

Toggle playback. if the gif is paused, play and pause if it's playing.

entity.components.gif.togglePlayback()

nextFrame()

Go to next frame. Useful if it's paused.

entity.components.gif.nextFrame()

paused()

Returns if it is paused.

const paused = entity.components.gif.paused() // true or false

Usage

Browser Installation

Install and use by directly including the browser files:

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.2.0/aframe.min.js"></script>
  <script src="https://rawgit.com/mayognaise/aframe-gif-shader/master/dist/aframe-gif-shader.min.js"></script>
  <script src="https://rawgit.com/mayognaise/aframe-gif-component/master/dist/aframe-gif-component.min.js"></script>
</head>

<body>
  <a-scene>
    <a-entity geometry="primitive:box" material="shader:gif;src:url(nyancat.gif);" gif=""></a-entity>
  </a-scene>
</body>

NPM Installation

Install via NPM:

npm i -D aframe-gif-shader aframe-gif-component

Then register and use.

import 'aframe'
import 'aframe-gif-shader'
import 'aframe-gif-component'

aframe-gif-component's People

Contributors

mayognaise avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

aframe-gif-component's Issues

Could there be a way to stretch this material/image?

I have this shader on a plane and my intention is to control the width and height of the plane+animated gif on it. That doesn't seem to work. May not be implemented. Does that sound like a feature you may consider putting in place?

Transparente Gif not working as expected

Hello everyone!
I have tried the component using transparent gif and it seems that the material doesn't clean every frame and keeps all the frames while the animation continues.
Any Idea why is this?
Are there any work arounds or plans to fix it or where we can check to fix it?

Thanks!

best way to change src afterward?

How do you suggest to change src to another gif? The new gif may have a different number of frames.
I've tried entity.setAttribute('src', 'url(newimg.gif') which works to swap gifs, but then page hangs after a few loops. I'm assuming frame idx is causing issue.

How do I swap src and update frame count or force reload of shader?

Thanks.

Gif controls

It seems that I cannot control gif from begin. Photoshop created gif loop forever, even if it set to loop only once(tested 2 loop too) in PS. Play/pause/tooglePlayback not have effect on begin of the script, but when i use controls after click event, or mouse enter etc. controls work. But anyway problem is that looping is un-controlled before first click on look event. I also tried make own function for controlling, but no lucky.
Of course there is way to trick it, with change src when click or look event happen, so i can control it from first frame. But of course it is much easier to control it from start. Some entity.reset() can also help there probably.. I feel gif's is so tricky :D
Any thoughts?

Transparent gifs

For transparent gifs it doesn't refresh the transparent canvas every frame, resulting in a strobing effect of gifs with transparent background.

Set source of gif by asset

Is there a way to set the source of a gif trough an asset id?
This way I can preload the images from an s3 bucket.

Broken in aframe v1.1.0

I can't get the gif-shader and gif-component to work in aframev1.1.0.

No errors in the console but when the gif is loaded the whole scene/renderer freezes

Any clues what could be wrong?

My gif's aren't working with this component

pokemon-8
Was using this aframe-gif component to display a gif(attached) in a VR environment but looks like it doesn't work. It leaves the traces behind after transitioning. May I know why it doesn't work?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.