menu

FramerX

A community of designers and developers who are interested in Framer X

Channels
Team

Update content based on page

December 16, 2019 at 10:57am

Update content based on page

December 16, 2019 at 10:57am
Hi, I'm trying to update components based on the current page of a page controller, but not sure why isn't working when the page goes beyond 1 Here's the code: import { Override, Data } from "framer"
const state = Data({ page: 0, title: "TITLE", name: "NAME", views: "999", pointX: 100, barWidth: 100, })
export function Page(): Override { return { currentPage: state.page, onChangePage: page => { state.page = 0 { state.title = "title1" state.name = "name1" state.pointX = 150 state.barWidth = 150 } state.page = 1 { state.title = "title2" state.name = "name2" state.pointX = 50 state.barWidth = 50 } state.page = 2 { state.title = "title3" state.name = "name3" state.pointX = 0 state.barWidth = 0 }
},
}
}
export function PageTitle(): Override { return { text: state.title, } }
export function PageArtist(): Override { return { text: state.name, } }
export function PageViews(): Override { return { text: state.views, } }
export function viewsDot(): Override { return { x: state.pointX, } }
export function viewsBar(): Override { return { width: state.barWidth, } }

January 15, 2020 at 5:48pm
Hey! You landed in the unofficial Framer Spectrum chat so we have less eyes on it here, you can find the official one under spectrum.chat/framer. I'd like to check out your project file if you're still stuck with this, would you mind sharing it to [email protected] if you still need help with it?
  • reply
  • like