Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>KYWaterWaveAnimation.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
26 changes: 16 additions & 10 deletions KYWaterWaveAnimation/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6751" systemVersion="14C1510" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -14,22 +18,23 @@
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mqB-Yp-XVM" customClass="KYWaterWaveView">
<rect key="frame" x="200" y="200" width="200" height="200"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="200"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="200" id="7aW-PW-xcS"/>
<constraint firstAttribute="width" constant="200" id="dVF-Hm-8eL"/>
<constraint firstAttribute="width" constant="375" id="dVF-Hm-8eL"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="mqB-Yp-XVM" secondAttribute="centerX" id="XBt-Hq-i5z"/>
<constraint firstAttribute="centerY" secondItem="mqB-Yp-XVM" secondAttribute="centerY" id="nxD-a0-WH1"/>
<constraint firstAttribute="trailing" secondItem="mqB-Yp-XVM" secondAttribute="trailing" id="I0s-Js-qFW"/>
<constraint firstItem="mqB-Yp-XVM" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leading" id="KNH-0j-9TD"/>
<constraint firstItem="mqB-Yp-XVM" firstAttribute="top" secondItem="kh9-bI-dsS" secondAttribute="top" id="qM4-n0-pcU"/>
</constraints>
</view>
<connections>
Expand All @@ -38,6 +43,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="45.600000000000001" y="35.532233883058474"/>
</scene>
</scenes>
</document>
4 changes: 2 additions & 2 deletions KYWaterWaveAnimation/KYWaterWaveView.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ - (UIBezierPath *)getgetCurrentWavePath {
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, nil, 0, waterWaveHeight);
CGFloat y = 0.0f;
for (float x = 0.0f; x <= waterWaveWidth ; x++) {
for (float x = 0.0f; x <= self.frame.size.width ; x++) {
y = self.waveAmplitude* sinf((360/waterWaveWidth) *(x * M_PI / 180) - offsetX * M_PI / 180) + waterWaveHeight;
CGPathAddLineToPoint(path, nil, x, y);
}

CGPathAddLineToPoint(path, nil, waterWaveWidth, self.frame.size.height);
CGPathAddLineToPoint(path, nil, self.frame.size.width, self.frame.size.height);
CGPathAddLineToPoint(path, nil, 0, self.frame.size.height);
CGPathCloseSubpath(path);

Expand Down
Binary file added 全屏宽度波浪线不到边缘.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.