Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hey hey #23

Open
trusktr opened this issue Mar 13, 2017 · 0 comments
Open

Hey hey #23

trusktr opened this issue Mar 13, 2017 · 0 comments

Comments

@trusktr
Copy link

trusktr commented Mar 13, 2017

Hi Piilwon, hope all is well. By they way, I've been making progress at github.com/trusktr/infamous. Will be updating the README soon. Right now it's basically a better version of Famous 0.3 with 0.5 sizing/mountPoint (started from scratch, not forked), with an HTML interface (made with Custom Elements), so integration with anything (Angular, React, etc) is really easy.

I'm aiming to add WebGL soon (mixed mode). I'd love some feedback, if you want to try it out. For example, to make something rotating right now, just npm install infamous then

import {Motor, Node, Scene} from 'infamous'

const scene = new Scene

const node = new Node({
  absoluteSize: {x:100, y:100},
  align: {x:0.5, y:0.5},
  mountPoint: {x:0.5, y:0.5},
})
node.element.innerHTML = "<h1>Hello!</h1>"
node.element.style.outline = "1px solid red"

scene.addChild(node)
scene.mount(document.body)

const fullSize = 'width:100%; height:100%;'
document.body.style.cssText = fullSize
document.querySelector('html').style.cssText = fullSize

Motor.addRenderTask(timestamp => {
  node.rotation.y++
})

That will make a rotating node in the middle of the scene.

You can also use the HTML API (via Angular, React, etc). Here's just with vanilla HTML:

import 'infamous/motor-html'

document.body.innerHTML = `
<motor-scene>
  <motor-node
    absoluteSize="100, 100"
    align="0.5, 0.5"
    mountPoint="0.5, 0.5"
    style="outline: 1px solid red"
    >
    <h1>Hello!</h1>
  </motor-node>
</motor-scene>
`

const fullSize = 'width:100%; height:100%;'
document.body.setAttribute('style', fullSize)
document.querySelector('html').setAttribute('style', fullSize)

Motor.addRenderTask(timestamp => {
  node.rotation.y++
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant