I’m an iOS engineer living in Mumbai, India.
You can follow me on Mastodon and read my blog.
An attempt to recreate the ring controls in Apple’s Activity app
License: MIT License
I’m an iOS engineer living in Mumbai, India.
You can follow me on Mastodon and read my blog.
I want to double rings like a donut!!
But I don' know the way to make this...please tell me...
Rings aren't appearing anti-aliased on watchOS. Are they anti-aliased on iOS?
Is this a bug where the anti-aliasing isn't working on watchOS, or is just the incredibly-small-size making it more obvious that it isn't anti-aliased?
SKShapeNode
does have an isAntialiased
property, but that's enabled. My hunch is that this has something to do with the custom shader (that generates the gradient?)
Hi,
I'm creating a pedometer app that tracks the user's steps. I set the goal to be 5000 and the number of steps the user has walked to be 5543. However, after the ring is filled up, there are two issues (see attached image):
The ring appears as if it's not filled up, and this portion extends a bit past where the "activityRingView.progress" section is.
This not filled section is blue, even though I set the not filled section to be gray.
How do I fix these two issues?
pod not installed show me error like this
The platform of the target WPoolMonitor Extension
(watchOS 4.0) is not compatible with ActivityRings (1.1.0)
, which does not support watchos
.
When I was experimenting this morning, I typed up this sample class:
class InterfaceController: WKInterfaceController {
@IBOutlet weak var activityRingInterfaceScene: WKInterfaceSKScene!
var activityRingScene = ActivityRingScene()
override func willActivate() {
activityRingScene.ringWidth = 15
activityRingInterfaceScene.presentScene(activityRingScene)
}
override func didAppear() {
activityRingScene.progress = 0.75
}
}
Which looks like this:
Took me a while to figure out what the issue was, but it turns out the ActivityRingScene
was defaulting to CGSize(width: 1, height: 1)
. The key to fixing that issue is something like ActivityRingScene(size: contentFrame.size)
.
I'm wondering if it would be worth trapping or emitting some warning when the ActivityRingScene
size is unreasonably small (like 1x1 in that example).
I can't think of a good way to make it automatically have the correct behavior, since we don't have an opportunity to subclass WKInterfaceSKScene
.
I attached 2 screenshots of my app. If you open them, you can tell that the edges of rings aren't smooth. And it's obvious on real devices. I thought it's because the rings are small (18 * 18 points in Screenshot 1), but even I set the size to 100 * 100 points (in screenshot 2), the issue is still visible to eyeballs on real devices.
I read through the source code, and I think it's a constraint of SpriteKit. But the gif in README.md seems smooth to me (because the gif is compressed?).
Screenshot 1 | Screenshot 2 |
---|---|
![]() |
![]() |
I don't know .....
Below, my coding
`var sceneMapping = WKInterfaceSKScene: ActivityRingScene
@IBOutlet var ring: WKInterfaceSKScene!
var label: SKLabelNode!
@IBOutlet var button: WKInterfaceButton!
override func awake(withContext context: Any?) {
super.awake(withContext: context)
button.setTitle("リングを動かす")
label = SKLabelNode()
}
override func willActivate() {
super.willActivate()
sceneMapping[ring] = ActivityRingScene(size: CGSize(width: 100, height: 100))
label.text = "20:40"
label.color = UIColor.white
for (interfaceScene, ringScene) in sceneMapping {
interfaceScene.presentScene(ringScene)
ringScene.animateProgress(to: 0.75, withDuration: 2.0)
ringScene.ringWidth = 8
}
}
override func didDeactivate() {
super.didDeactivate()
}
//buttonを押した時のメソッド
@IBAction func buttonTapped() {
print("設定ボタンが押されました")
for (interfaceScene, ringScene) in sceneMapping {
interfaceScene.presentScene(ringScene)
ringScene.animateProgress(to: 0.5, withDuration: 0.5)
ringScene.ringWidth = 8
}
}`
Please check and tell me................
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.