My problem is that I haven't figure out how to align the spaces responsively. I've tried using vw/vh's and %s but both break consistency on different view sizes. Can anyone recommend a straight-forward way to lock down this board?
I didn't want to use multiple canvas bc of the cpu drain of 50+ spaces and don't want to use an image map because that's not responsive.
Hi guys and gals,
I'm trying to port a board game into HTML via angular 1.x. I have an object with each board space, and have given each space a location origin via absolute positioning (top, left) and made a quick function that takes all the properties in a transform property and returns a string for css transform in ng-style.
Here's an example of the first few spaces:
1: {color: colors.blue, origin:{top:'65%', left:'13%'}, tForm: {rotate:'-21deg'}},
2: {color: colors.yellow, origin:{top:'66.5%', left:'8.5%'}, tForm: {rotate:'-35deg'}},
3: {color: colors.black, origin:{top:'70%', left:'6%'}, tForm: {rotate:'-72deg'}},
4: {color: colors.red, origin:{top:'75%', left:'5.5%'}, tForm: {rotate:'0deg'}},
5: {color: 'cool?', origin:{top:'80%', left:'6%'}, tForm: {rotate:'-21deg'}}
Here's the code that's processing those properties (mostly in ng-style):
<span id="space-{{space}}" ng-repeat="space in section" ng-init="bgColor = cool.di.models.spaces[space].color === 'trap' ? '#900020' : cool.di.models.spaces[space].color === 'cool?' ? 'rgba(230,232,234, 1)': cool.di.models.spaces[space].color === 'pass' ? 'green' : cool.di.models.spaces[space].color"
ng-style="{padding:'.1em', color:'mintcream', background:bgColor, border:'1px solid rgba(0,0,0,.2)', position:'absolute', top: cool.di.models.spaces[space].origin.top, left: cool.di.models.spaces[space].origin.left, transform: cool.di.api.tForm(cool.di.models.spaces[space].tForm), height:'2em', width:'2em'}">
Here's my current progress on the "C" https://irthos.github.io/cool/#/board
Thanks for any suggestions!